package top.v5it.japi.plus.common.tuple;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.experimental.Accessors;

/**
 * 九元组
 *
 * @author zhanpu
 * @date 2022/6/15
 */
@Getter
@EqualsAndHashCode(callSuper = false)
public class Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> {

    private static final long serialVersionUID = -5340247923741190792L;
    final T9 nine;

    Tuple9(T1 one, T2 two, T3 three, T4 four, T5 five, T6 six, T7 seven, T8 eight, T9 nine) {
        super(one, two, three, four, five, six, seven, eight);
        this.nine = nine;
    }

    @Override
    public Object[] toArray() {
        return new Object[]{this.one, this.two, this.three, this.four, this.five, this.six, this.seven, this.eight, this.nine};
    }

    @Override
    public int size() {
        return 9;
    }

    @Override
    public Object get(int index) {
        switch (index) {
            case 0:
                return this.one;
            case 1:
                return this.two;
            case 2:
                return this.three;
            case 3:
                return this.four;
            case 4:
                return this.five;
            case 5:
                return this.six;
            case 6:
                return this.seven;
            case 7:
                return this.eight;
            case 8:
                return this.nine;
            default:
                return null;
        }
    }
}
